package com.jqr.activity.mycoroutine

import android.annotation.SuppressLint
import android.os.AsyncTask
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import com.jqr.activity.mycoroutine.api.userServiceApi
import com.jqr.activity.mycoroutine.models.Articles
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlin.coroutines.Continuation
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.createCoroutine
import kotlin.coroutines.resume

class MainActivity3 : AppCompatActivity() {
    @OptIn(DelicateCoroutinesApi::class)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main1)

        //协程体
        //基础设施层
       val continuation= suspend {
            5
        }.createCoroutine(object :Continuation<Int>{
            override val context: CoroutineContext=EmptyCoroutineContext

            override fun resumeWith(result: Result<Int>) {
                println("")
            }
        })
        continuation.resume(Unit)

    }
}
